Back to articles
Technology Insight

Comprehensive VPS Security: Replacing Traditional SSH Keys with SSH Certificates

June 4, 2026

Introduction: The Hidden Flaws of Traditional SSH Authentication

For years, public key authentication (SSH Keys) has been hailed as the gold standard for securing Virtual Private Servers (VPS). Compared to easily brute-forced passwords, cryptographic keys offer superior protection. However, as infrastructure scales, traditional SSH keys introduce significant operational overhead and security risks. Managing hundreds of public keys across multiple servers often leads to key sprawl, orphaned access, and an absolute lack of centralized control.

To solve these enterprise-level security challenges, modern DevOps and security teams are shifting toward SSH Certificates. Unlike standard keys, SSH certificates introduce a trusted third party—a Certificate Authority (CA)—to validate identities, manage expiration dates, and eliminate the need to manually append public keys to every single server. This guide will walk you through the architecture, benefits, and step-by-step implementation of SSH Certificates to achieve comprehensive VPS security.

The Core Problem with SSH Keys at Scale

Before diving into certificates, it is crucial to understand why the traditional approach fails in growing environments:

  • No Built-in Expiration: Once a traditional SSH public key is added to a server's authorized_keys file, it remains valid forever unless manually removed. If an employee leaves the company or a laptop is compromised, that key poses a permanent threat.
  • The Trust-on-First-Use (TOFU) Vulnerability: When connecting to a new VPS, users face the familiar "The authenticity of host... can't be established" warning. Most users blindly accept this prompt, leaving them vulnerable to Man-in-the-Middle (MitM) attacks.
  • High Management Overhead: Adding, rotating, and revoking keys across dozens of servers requires complex configuration management tools (like Ansible or Puppet) or tedious manual labor.

What is an SSH Certificate?

An SSH Certificate is not the same as an SSL/TLS certificate used for websites, though it shares similar conceptual roots. An SSH Certificate is a standard SSH public key that has been digitally signed by an SSH Certificate Authority (CA).

The certificate wraps the public key with critical metadata, including:

  1. Identity/Principals: The specific usernames (e.g., root, ubuntu, john) the certificate is authorized to log into.
  2. Validity Period: A strict expiration timestamp (e.g., valid for only 8 hours).
  3. Extensions: Permissions regarding port forwarding, agent forwarding, or terminal access.
Rather than verifying if a specific key exists in a local database, the VPS simply checks if the presented certificate was signed by the trusted CA and whether it is still valid. If it passes, access is granted instantly.

Architectural Overview: How SSH Certificate Authentication Works

The authentication workflow changes fundamentally when transitioning from traditional keys to certificates. The ecosystem relies on three core components:

1. The Certificate Authority (CA)

An isolated, highly secure server holding the CA private key. This key is used exclusively to sign user and host public keys.

2. User Certificates (Client Authentication)

Instead of copying the developer's public key to the VPS, the developer sends their public key to the CA. The CA verifies their identity (often tied to an Identity Provider via Single Sign-On) and issues a short-lived User Certificate. The user presents this certificate to the VPS during login.

3. Host Certificates (Server Authentication)

To eliminate the TOFU problem, the VPS itself generates a host key pair, which is signed by the CA to create a Host Certificate. When a user connects, the server presents this certificate, and the user's local machine instantly verifies it is connecting to the legitimate server.

Step-by-Step Implementation Guide

Let us look at how to construct a basic SSH Certificate architecture using native OpenSSH tools. For this example, we will assume you have a dedicated machine acting as the CA, and a target VPS.

Step 1: Create the Certificate Authority Keys

On your secure CA machine, generate two separate key pairs: one for signing users, and one for signing hosts.

# Generate User CA key
ssh-keygen -t ed25519 -f /etc/ssh/user_ca -C "User Certificate Authority"

# Generate Host CA key
ssh-keygen -t ed25519 -f /etc/ssh/host_ca -C "Host Certificate Authority"

Step 2: Configure the VPS to Trust the User CA

To allow users with valid certificates to log in, the VPS needs to know the CA's public key. Copy /etc/ssh/user_ca.pub from the CA machine to your VPS (e.g., to /etc/ssh/user_ca.pub).

Next, edit the OpenSSH server configuration file (/etc/ssh/sshd_config) on the VPS and add the following line:

TrustedUserCAKeys /etc/ssh/user_ca.pub

Restart the SSH service to apply changes:

sudo systemctl restart sshd

Step 3: Signing a User Key and Logging In

When a user wants to access the VPS, they generate a standard key pair and send their public key (id_ed25519.pub) to the CA. The CA operator (or an automated script) signs the key using the user CA private key:

ssh-keygen -s /etc/ssh/user_ca -I "john_vps_access" -n ubuntu,root -V +8h id_ed25519.pub

Let's break down these flags:

  • -s: Specifies the CA private key.
  • -I: An identity string used for logging and auditing purposes.
  • -n: The principals (usernames) this certificate is allowed to log into on the VPS.
  • -V: The validity duration. +8h ensures the certificate expires automatically in 8 hours.

This generates a new file named id_ed25519-cert.pub. The user places this file in their local ~/.ssh/ directory alongside their private key. When they run ssh ubuntu@vps-ip, the login succeeds automatically without their public key ever being copied to the VPS.

Business and Security Benefits of SSH Certificates

Transitioning to SSH Certificates delivers immediate, measurable advantages for modern enterprise infrastructures:

1. Ephemeral Access Control

By enforcing short-lived certificates (e.g., matching an 8-hour workday), you drastically reduce the blast radius of a compromised credential. If a developer's laptop is stolen, the attacker gains no permanent infrastructure access because the certificate will naturally expire within hours.

2. Centralized Revocation and Auditing

Because every certificate signing event is logged at the CA, security teams gain a centralized audit trail of who requested access, when, and for which principals. If immediate access revocation is required, OpenSSH supports RevokedKeys files, allowing administrators to invalidate specific certificates instantly across the fleet.

3. Streamlined Employee Onboarding and Offboarding

When a new engineer joins the team, you no longer need to propagate their public key to hundreds of production instances. They simply authenticating via the CA. Conversely, when an employee departs, disabling their account at the central identity provider automatically stops them from obtaining new certificates, cutting off infrastructure access instantly.

Conclusion

Relying on traditional SSH keys for growing VPS environments creates architectural technical debt and introduces insidious security blind spots. Implementing SSH Certificates modernizes your infrastructure access control by enforcing short-lived, identity-bound access permissions, cutting down maintenance costs, and eradicating the operational hazards of key management. While setting up a native OpenSSH CA requires careful planning, the security dividends and peace of mind it provides make it an essential upgrade for any security-conscious business.

Comprehensive VPS Security: Replacing Traditional SSH Keys with SSH Certificates | DPTCloud