Short-Lived SSH Certificates: How They Work and Why They Matter
SSH has traditionally relied on long-lived public-key credentials.
An administrator generates a key pair, distributes the public key to the servers they need to access, and uses the corresponding private key to authenticate.
The arrangement is simple, reliable and supported almost everywhere.
It also creates a persistent security problem: access credentials can remain valid long after they were originally issued.
Keys may survive employee departures, infrastructure changes, forgotten accounts and abandoned development environments. If a private key is copied or compromised, it may continue to provide access until the corresponding authorization is removed.
Short-lived SSH certificates offer a different approach.
Instead of relying on indefinitely authorized public keys, users authenticate using certificates that are valid for a deliberately limited period.
The certificates are issued by a trusted SSH Certificate Authority and can contain identities, permitted principals, restrictions and expiration times.
Once the certificate expires, it cannot be used to establish new SSH sessions.
Combined with automated issuance and appropriate access policies, short-lived SSH certificates can significantly reduce the persistence of SSH credentials across an organization.
In this guide
What Are Short-Lived SSH Certificates?
A short-lived SSH certificate is an OpenSSH certificate issued with a relatively brief validity period.
It contains a public key, certificate metadata and a digital signature from a trusted SSH Certificate Authority.
The certificate also specifies when it becomes valid and when it expires.
A certificate might be issued for 15 minutes, one hour or the duration of an approved administrative task.
There is no single required lifetime.
The appropriate duration depends on the organization's security requirements, authentication mechanisms, operational processes and tolerance for interrupted workflows.
The underlying authentication mechanism remains standard OpenSSH certificate authentication.
The distinction is operational: certificates are intentionally temporary rather than issued for months or years.
What Makes a Certificate Short-Lived?
OpenSSH does not define a special certificate type called a short-lived certificate.
A short-lived certificate is simply a normal SSH certificate with a restricted validity interval.
For example:
ssh-keygen -s user_ca \
-I alice-session-001 \
-n alice \
-V +15m \
user_key.pubThis signs the user's public key and issues a certificate valid for approximately 15 minutes from the signing time.
The resulting certificate can be used for authentication only while it is valid, subject to the server's trust and authorization requirements.
The private key is still required.
A certificate does not replace the key pair or eliminate the need to protect private keys.
Why Long-Lived SSH Credentials Are a Problem
Traditional SSH public-key authentication typically depends on public keys stored in server-side authorization files or managed through another authorization mechanism.
These keys do not contain a built-in expiration time.
Once authorized, a key may remain usable until the server's configuration changes or another control prevents its use.
This creates several operational challenges.
Forgotten Access
A public key may remain authorized on a server long after the person who originally needed access has changed roles or left the organization.
Unless the authorization is removed, the server may continue to accept the key.
Credential Theft
If an attacker obtains a private key and can satisfy any other applicable authentication requirements, the key may remain useful for as long as its public key is authorized.
The attacker does not necessarily need to compromise the server itself.
Infrastructure Sprawl
As organizations add servers, environments and administrative accounts, individual key authorization becomes increasingly difficult to track.
The same public key may be authorized across multiple systems, making it harder to determine the full impact of a compromise.
Inconsistent Revocation
Removing a compromised public key requires administrators or automation to update every relevant authorization location.
If even one system retains the authorization, the key may remain usable there.
Short-lived certificates do not eliminate these problems automatically, but they change the duration and management of credential validity.
How Short-Lived SSH Certificates Work
Short-lived certificate authentication uses the same trust model as ordinary OpenSSH certificates.
The SSH server trusts a certificate authority rather than requiring each user's public key to be individually installed.
The certificate authority signs a public key and includes a validity interval and permitted principals.
When the client connects, the server verifies the certificate signature, checks its validity and applies its authorization policy.
The client must prove possession of the corresponding private key.
A typical automated workflow consists of six stages.
Short-Lived SSH Certificate Lifecycle
Authenticate, authorize, issue, connect, expire, then reauthenticate for a new certificate when needed.
Authenticate the User
The user authenticates with a trusted identity system, such as an organizational identity provider or another approved mechanism.Authorize the Request
The issuing system determines whether the user is permitted to access the requested infrastructure based on applicable organizational policies.Issue the Certificate
If approved, the certificate authority signs the public key and issues a certificate containing permitted principals, restrictions and a validity interval.Connect Using SSH
The user connects with a standard OpenSSH client. The server validates the certificate and the client proves possession of the private key.Certificate Expires
After the validity interval ends, the certificate is no longer accepted for new authentication.Reauthenticate and Request a New Certificate
When additional access is required, the user requests a new certificate so identity and authorization can be evaluated again.
Six-stage lifecycle of short-lived SSH certificate issuance and use.
1. Authenticate the User
The user authenticates with a trusted identity system.
This might involve an existing organizational identity provider, multifactor authentication or another approved authentication mechanism.
The certificate authority should not issue credentials merely because someone possesses an SSH public key.
2. Authorize the Request
The issuing system determines whether the user is permitted to access the requested infrastructure.
This may include evaluating identity, group membership, requested principals, device information or other organizational policies.
Authentication establishes who is requesting access.
Authorization determines what that identity is permitted to do.
3. Issue the Certificate
If the request is approved, the certificate authority signs the user's public key.
The resulting certificate contains the permitted principals, validity interval and any applicable restrictions.
The CA private key remains protected by the issuing system.
The user's private key does not need to be transferred to the CA.
4. Connect Using SSH
The user connects with a standard OpenSSH client using the private key and issued certificate.
The server validates the certificate against its configured trust and authorization rules.
No proprietary SSH authentication protocol is required.
5. Certificate Expires
After the validity interval ends, the certificate is no longer accepted for new authentication.
The user cannot simply continue establishing new connections with the expired certificate.
6. Reauthenticate and Request a New Certificate
When additional access is required, the user requests a new certificate.
The issuing system can re-evaluate identity and authorization before granting another temporary credential.
This creates opportunities to enforce current access policies rather than relying indefinitely on previously distributed credentials.
SSH Certificate Expiration Is Not Session Termination
One of the most important distinctions in short-lived SSH authentication is the difference between certificate validity and session lifetime.
An SSH certificate is checked during authentication.
Once the connection has been authenticated, the certificate's expiration does not automatically terminate that established SSH session.
For example, a user might authenticate with a certificate valid for 15 minutes and maintain an SSH session for several hours.
The certificate could expire while the session remains connected.
The expired certificate would no longer be valid for establishing a new authenticated connection, but the existing session would not automatically close simply because the certificate expired.
This distinction matters when designing access policies.
Short-lived certificates reduce the window for new authentication using compromised credentials.
They are not, by themselves, a mechanism for enforcing maximum session duration.
Organizations requiring immediate access termination or strict session time limits need additional controls.
Short-Lived Certificates vs SSH Key Rotation
SSH key rotation and short-lived certificates address related but different security concerns.
Key rotation replaces cryptographic key material.
Certificate expiration limits how long a particular authorization credential remains valid.
These mechanisms are complementary.
SSH Key Rotation
- Replaces cryptographic key material.
- Generally requires distributing replacement public keys and removing old authorization.
- Can become complicated when one key is used across many servers.
Short-Lived Certificate Issuance
- Limits how long an authorization credential remains valid.
- Allows repeated signing of a user public key with updated principals and validity periods.
- Separates key lifecycle from authorization credential lifecycle.
SSH Key Rotation
With traditional SSH public-key authentication, rotating a key generally involves generating a replacement key pair, distributing the new public key to authorized systems and removing the old authorization.
The process can become complicated when a key is used across multiple servers.
Rotation also does not guarantee that an old key has been removed everywhere.
Short-Lived Certificate Issuance
With certificate-based authentication, a user's public key can be signed repeatedly with new certificates.
Each certificate can contain updated principals, restrictions and validity periods.
The underlying key pair does not necessarily need to change every time a certificate is issued.
This separates the lifecycle of the cryptographic key from the lifecycle of the authorization credential.
Short-lived certificates should not be presented as a complete replacement for key management.
Private keys still need to be protected, and compromised keys may need to be replaced.
How Long Should SSH Certificates Be Valid?
There is no universally correct certificate lifetime.
Shorter validity periods reduce the time during which a stolen certificate can be used for new authentication, but they also increase the frequency with which users or automated systems need fresh credentials.
The appropriate lifetime depends on the environment.
Fifteen-Minute Certificates
Very short certificates may be suitable for interactive administrative access where issuance is automated and obtaining a new certificate is straightforward.
They reduce the window during which a stolen certificate remains useful for new authentication.
One-Hour Certificates
One-hour certificates can provide a balance between convenience and limiting credential validity.
They may be suitable for interactive engineering workflows where frequent renewal is acceptable.
Working-Day Certificates
Longer certificates may be appropriate for workflows where frequent reauthentication would be disruptive.
However, a longer validity period also increases the time during which a compromised certificate can be reused for new connections.
Automated Workloads
Automated processes should use lifetimes appropriate to their execution model.
A certificate used for a short deployment operation may not need to remain valid after that operation completes.
Long-running automation may require a secure mechanism for requesting fresh credentials.
The objective is not to select the shortest possible lifetime regardless of consequences.
It is to minimize unnecessary credential validity while maintaining reliable and secure operations.
Can Short-Lived SSH Certificates Be Revoked?
Yes.
OpenSSH supports certificate and key revocation through mechanisms including Key Revocation Lists.
However, certificate expiration and revocation are different controls.
Expiration occurs automatically when the validity interval ends.
Revocation allows a credential to be rejected before its scheduled expiration, provided the relevant systems have received and enforce the revocation information.
For example, an administrator may need to revoke access immediately after discovering that a user's private key has been compromised.
Waiting for the certificate to expire may not be acceptable.
The Revocation Distribution Problem
OpenSSH certificate validation normally occurs locally.
A server can verify a certificate using its trusted CA public key without contacting the issuing authority for each connection.
This is useful for reliability, but it also means that centrally revoking a certificate does not automatically inform every server.
Revocation information must be distributed or authorization must be changed through another effective mechanism.
Short-lived certificates reduce the duration of exposure, but they do not eliminate the need for incident response and revocation procedures.
What Happens When an Identity Is Disabled?
Unless the SSH server consults an appropriate additional control, an existing unexpired certificate may remain usable until it expires or is revoked.
This is an important consideration when integrating certificate issuance with centralized identity systems.
A secure design must account for both future certificate issuance and credentials that have already been issued.
Why Certificate Automation Matters
Short-lived credentials are only practical at scale when obtaining them is convenient.
If every certificate requires a manual administrator action, short validity periods quickly become an operational burden.
An automated issuance service can authenticate a user, evaluate policy, sign an approved public key and return a certificate.
The user can then authenticate using a standard SSH client.
Automation can also support consistent certificate lifetimes, controlled principals and issuance records.
However, automation must not become a mechanism for issuing unrestricted credentials.
The security of the system depends on the controls applied before signing.
Authentication Is Not Authorization
A user successfully authenticating with an identity provider does not necessarily mean they should receive access to every server.
Certificate issuance must consider what the authenticated identity is allowed to access.
For example, an engineer may be authorized to access development infrastructure but not production systems.
The certificate issuance process should reflect that distinction.
Device Trust
In some environments, user identity alone is not sufficient.
Organizations may also want to evaluate the device from which access is requested.
Device trust can provide additional assurance that credentials are being issued to an approved device rather than an unknown or compromised endpoint.
However, device trust is an additional control layered around certificate issuance.
It is not an inherent property of the OpenSSH certificate format.
Protecting the Certificate Authority
Automated issuance increases the importance of protecting the CA private key.
A compromised signing authority could issue unauthorized certificates that are accepted by systems trusting that authority.
Production deployments should restrict access to CA signing operations, enforce authorization before issuance and maintain appropriate monitoring and audit records.
Just-in-Time SSH Access
Short-lived certificates are a useful building block for just-in-time infrastructure access.
Rather than granting permanent access to infrastructure, a system can evaluate a request and issue a temporary credential for an approved purpose.
For example, an engineer may request production access to investigate an incident.
The access management system can authenticate the engineer, evaluate the request and issue a certificate with the appropriate principal and validity period.
The engineer then connects using their normal SSH client.
When the certificate expires, it cannot be used to establish additional authenticated sessions.
However, true just-in-time access requires more than certificate expiration.
The issuing system must enforce authorization, and the infrastructure must apply the intended restrictions.
If immediate access termination is required, additional revocation or session-management mechanisms may also be necessary.
Short-lived certificates provide a cryptographic mechanism for time-limited authentication.
Just-in-time access is the broader policy and operational process built around that mechanism.
Common Mistakes with Short-Lived SSH Certificates
Assuming Expiration Terminates Sessions
Certificate expiration does not automatically disconnect existing SSH sessions.
Session management must be addressed separately.
Using Long-Lived CA Credentials Without Protection
Short-lived user certificates provide limited benefit if an attacker can freely access the CA private key and issue new certificates.
Protect the signing authority.
Automatically Renewing Without Rechecking Authorization
Issuing a new certificate should involve evaluating current authorization.
Possession of an earlier certificate should not automatically grant indefinite access.
Treating Principals as Permissions Without Server Policy
Certificate principals are evaluated through the server's authorization configuration.
A principal is not a universal permission that automatically grants access to every server.
Ignoring Private Key Compromise
Certificates still rely on private keys.
If the corresponding private key is compromised, an attacker may be able to authenticate using any currently valid certificate associated with that key.
Confusing Short-Lived Credentials with Immediate Revocation
Expiration limits the duration of credential validity.
It does not provide immediate revocation unless additional mechanisms are implemented.
Managing Short-Lived SSH Certificates with SSH Teams
OpenSSH provides native support for certificate-based authentication, including certificate validity periods, principals and CA trust.
What it does not provide by itself is a complete organizational workflow for authenticating users, evaluating access policy and issuing temporary credentials.
SSH Teams builds on the native OpenSSH certificate mechanism to provide managed, short-lived SSH access.
It is designed to connect certificate issuance to existing identity and access controls while allowing users to continue working with standard SSH clients and servers.
Rather than distributing permanent individual public keys throughout an infrastructure estate, organizations can establish trust in a certificate authority and manage credential issuance centrally.
SSH Teams also incorporates device-trust mechanisms into its access model, providing additional controls around certificate requests.
The result is a practical approach to short-lived SSH access without requiring a proprietary SSH protocol or mandatory bastion host.
Explore SSH Teams
Frequently Asked Questions
Are short-lived SSH certificates more secure than permanent SSH keys?
They can reduce the period during which compromised credentials remain valid for new authentication. Their overall security depends on CA protection, private key security, authorization policy and issuance controls.
Do short-lived SSH certificates require a new SSH client?
No. OpenSSH supports certificate authentication natively. Appropriate configuration and a mechanism for obtaining certificates are required.
Does a 15-minute SSH certificate disconnect the user after 15 minutes?
No. Certificate expiration generally prevents new authentication. It does not automatically terminate an existing SSH session.
Can an SSH certificate be renewed?
A new certificate can be issued for the same public key after appropriate authentication and authorization checks. The existing certificate is not extended in place.
Do short-lived certificates eliminate SSH key rotation?
No. Certificates separate credential validity from key lifetime, but private keys still require protection and may need rotation.
What happens if the certificate authority is unavailable?
Previously issued certificates can generally continue to be validated by servers that trust the CA, provided the certificates remain valid and satisfy authorization requirements. New certificate issuance may be unavailable until the issuing service is restored.
Can a disabled employee still use an existing certificate?
Potentially, until the certificate expires or another effective control prevents its use. Disabling an identity does not inherently invalidate an already issued OpenSSH certificate.
Are short-lived SSH certificates suitable for automation?
Yes. They can be useful for automated workloads when credential issuance, authorization and renewal are designed to operate securely without manual intervention.
Further Reading
OpenSSH Certificates: The Complete Guide to SSH Certificate Authentication
Learn how SSH certificate authorities, trust relationships, user certificates and host certificates work.
OpenSSH Certificate Cheatsheet
Practical ssh-keygen commands for creating certificate authorities, signing certificates, configuring principals and managing certificate validity.
/openssh-certificate-cheatsheet/
SSH Teams
Explore managed, short-lived SSH certificate authentication using existing SSH infrastructure.