Securing SSH with the YubiKey (2024)

Secure Shell (SSH) is often used to access remote systems. It provides a cryptographically secure channel over an unsecured network. SSH uses public-key cryptography to authenticate the remote system and allow it to authenticate the user.

SSH also offers passwordless authentication. In this scenario, a public-private key pair is manually generated. The public key is placed on all remote systems and allows access to the owner of the matching private key. The owner is responsible for keeping the private key secret. Owners can secure private keys with the YubiKey by importing them or, better yet, generating the private key directly on the YubiKey. Private keys cannot be exported or extracted from the YubiKey.

The YubiKey supports various methods to enable hardware-backed SSH authentication.

PIV

The YubiKey stores and manages RSA and Elliptic Curve (EC) asymmetric keys within its PIV module. It will work with SSH clients that can communicate with smart cards through the PKCS#11 interface.

Pros:

  • Centralized management of keys

  • Standardized security policies across endpoints

  • Wide Support for PKCS#11

  • Ideal for organizations with an existing PKI deployment

Cons:

  • No chain validation of certificates

  • Each key must be revoked individually

PGP

The YubiKey stores and manages OpenPGP keys within its OpenPGP module. It will work with SSH clients that have integrated with the OpenPGP standard.

Pros:

  • Simple to manage keys on a single locally controlled machine

  • Easy to export and share public Key

  • Ideal for individual users

Cons:

  • No key recovery in event of lost YubiKeys

  • OpenPGP is not widely supported by credential management services

FIDO2

OpenSSH version 8.2p1 added support for FIDO hardware authenticators. FIDO devices are supported by the public key types “ecdsa-sk” and “ed25519-sk", along with correspondingcertificate types.

ssh-keygen may be used to generate a FIDO token-backed SSH key, after which such keys may be used much like any other key type supported by OpenSSH, provided that the YubiKey is plugged in when the keys are used. YubiKeys require the user to explicitly authorize operations by touching or tapping them.

The Security Key by Yubico and the YubiKey Bio Keys support authenticating to SSH with FIDO2 credentials.

Pros:

  • Easy to register and use keys quickly

  • Configurations for both public and secured endpoints

  • Does not require a dedicated YubiKey for just SSH authentication; can use the same device with other FIDO2/WebAuthn services

Cons:

  • Not supported on Windows as of the last update to this page

  • Disabled by Apple on the bundled version of OpenSSH in MacOS as of the last update to this page.

  • No credential management support as of the last update to this page

OTP

Systems administrators can configure two factor authentication for SSH authentication using the YubiKey through the Yubico PAM module.

Pros:

  • Legacy solution with support for older versions of SSH.

Cons:

  • Not as secure as an asymmetric key based solution

  • Supporting frameworks approaching end of life in many cases

As a seasoned expert in cybersecurity and authentication mechanisms, I've had extensive hands-on experience with various secure communication protocols, including the Secure Shell (SSH) protocol. My expertise extends to the implementation and optimization of SSH for remote system access, focusing on cryptographic security and robust authentication methods.

Let's delve into the concepts presented in the article regarding the utilization of YubiKey for SSH authentication. The article covers three main methods: PIV, PGP, FIDO2, and OTP.

PIV (Personal Identity Verification):

Overview: The YubiKey's PIV module stores and manages RSA and Elliptic Curve (EC) asymmetric keys. It enables hardware-backed SSH authentication with SSH clients communicating through the PKCS#11 interface.

Pros:

  • Centralized key management.
  • Standardized security policies.
  • Wide support for PKCS#11.
  • Ideal for organizations with an existing PKI deployment.

Cons:

  • No chain validation of certificates.
  • Individual revocation of keys required.

Considerations: Advantages and considerations of configuring OpenSSH with the YubiKey using PIV are provided, along with step-by-step instructions.

PGP (Pretty Good Privacy):

Overview: YubiKey's OpenPGP module manages OpenPGP keys, allowing SSH authentication with clients integrated with the OpenPGP standard.

Pros:

  • Simple key management on a single machine.
  • Easy export and sharing of public keys.
  • Ideal for individual users.

Cons:

  • No key recovery in case of lost YubiKeys.
  • Limited support by credential management services.

Considerations: The article outlines advantages and considerations of configuring OpenSSH with the YubiKey using OpenPGP, accompanied by configuration instructions.

FIDO2:

Overview: OpenSSH version 8.2p1 introduced support for FIDO hardware authenticators, including YubiKeys. FIDO devices support public key types "ecdsa-sk" and "ed25519-sk," with corresponding certificate types.

Pros:

  • Easy registration and quick key usage.
  • Configurations for public and secured endpoints.
  • No need for a dedicated YubiKey for SSH.

Cons:

  • Not supported on Windows (as of the last update).
  • Disabled by Apple on bundled OpenSSH in MacOS (as of the last update).
  • No credential management support (as of the last update).

Considerations: Configuration instructions for enabling SSH authentication with the YubiKey and FIDO2 are detailed in the article.

OTP (One-Time Password):

Overview: Two-factor authentication for SSH using YubiKey through the Yubico PAM module.

Pros:

  • Legacy solution supporting older SSH versions.

Cons:

  • Less secure compared to asymmetric key-based solutions.
  • Supporting frameworks approaching end-of-life.

Considerations: Step-by-step instructions for configuring the Yubico PAM module for SSH with OTP are provided in the article.

In conclusion, the article comprehensively explores YubiKey's capabilities for enhancing SSH security through various authentication methods. It caters to different use cases, from organizational PKI deployments to individual user scenarios, providing a nuanced understanding of the strengths and limitations of each approach.

Securing SSH with the YubiKey (2024)

FAQs

How to secure SSH with YubiKey? ›

Configuring the SSH Client
  1. Insert the security key.
  2. Open a terminal.
  3. Generate the ssh credential files: ssh-keygen -t ed25519-sk -O resident -O verify-required -C "Your Comment"
  4. Enter the PIN and touch the key when prompted.
  5. Save the files ( id_ed25519_sk and id_ed25519_sk. pub ) in the ~/. ssh directory.

How to secure SSH with keys? ›

To tighten security controls around SSH keys, you should also apply the following 10 best practices:
  1. Discover all SSH Keys and Bring Under Active Management. ...
  2. Change Default SSH Port. ...
  3. Disable SSH Root Login. ...
  4. Implement Two-Factor Authentication. ...
  5. Ensure SSH Key Attribution. ...
  6. Enforce Minimal Levels of User Rights Through PoLP.
Nov 22, 2022

What are the security issues with SSH keys? ›

Common SSH security risks
  • Unapproved SSH servers. ...
  • Unpatched SSH software. ...
  • Vulnerable SSH configuration. ...
  • SSH port forwarding. ...
  • Private key compromise. ...
  • Unauthorized SSH access. ...
  • Privilege escalation. ...
  • Rogue known host keys.
Oct 30, 2023

How is YubiKey more secure? ›

Other 2FA methods typically only send you a six-digit code to confirm your identity, mostly because it would be unreasonable to expect humans to type much more than that. YubiKeys don't require you to manually enter a code, so they're free to use much longer codes. That's more secure.

How do I make sure my SSH is secure? ›

Enforcing Strong Authentication
  1. Require strong passwords. Require passwords that are at least twelve characters long, and combine uppercase and lowercase letters, numbers, and special characters.
  2. Enable two-factor authentication. ...
  3. Regularly update passwords. ...
  4. Implement account lockouts. ...
  5. Educate users. ...
  6. Use SSH keys.

Which YubiKey is most secure? ›

The YubiKey 5 FIPS certified security keys meet the highest level of assurance (AAL3) of the new NIST SP800-63B guidelines.

What is the most secure SSH key? ›

ssh\id_ed25519 on Windows). We strongly recommend using only the ed25519 algorithm (an ECDSA variant). It is the most secure SSH key type widely available, and is very well supported in the majority of systems. If you are using an client or server without ed25519 support, you should consider upgrading where possible.

Are SSH keys more secure than passwords? ›

From a security standpoint, using SSH-keys to authenticate a user's identity leads to greater protection of your data. Username/password authentication can often lead to security compromises, in particular, brute force attacks by hackers.

Is passwordless SSH more secure? ›

SSH Passwordless Login FAQ

If you simply press Enter without typing a passphrase, the key will be created without one. While this allows for passwordless authentication, it is important to note that such a key is less secure because it can be used by anyone who obtains the private key.

Can SSH keys be compromised? ›

SSH keys are used for authentication, enabling secure access to servers and other network devices. However, when SSH keys fall into the wrong hands, they can be used to gain unauthorized access to systems, steal data, and cause other security issues.

Is SSH actually secure? ›

SSH is "secure" because it incorporates encryption and authentication via a process called public key cryptography. Public key cryptography is a way to encrypt data, or sign data, with two different keys. One of the keys, the public key, is available for anyone to use.

What are the disadvantages of SSH keys? ›

First, keys are more difficult to set up and maintain than passwords. You need to generate, distribute, and store your keys securely, and update them regularly. Second, keys can pose a security risk if they are lost, stolen, or compromised.

Should I leave my YubiKey plugged in all the time? ›

Do I need to keep my yubikey plugged in all the time? A. No, you only need to insert your yubikey when you are prompted to do so during login. Leaving it plugged in could result in the yubikey being lost or damaged.

Is one YubiKey enough? ›

Yubico always recommends adding two keys to each of your online services and accounts; one primary and one secondary as backup in case the primary is lost.

What is the lifespan of a YubiKey? ›

A Yubikey will essentially last forever, and if you stay clear of the insanity that is Passkeys its Webauthn element can support an infinite number of websites. Portability: I have a smartphone, a work laptop, a home laptop, and a home desktop. My Yubikey has USB and NFC, so it can trivially be used with all of them.

What is the best encryption for SSH keys? ›

We strongly recommend using only the ed25519 algorithm (an ECDSA variant). It is the most secure SSH key type widely available, and is very well supported in the majority of systems. If you are using an client or server without ed25519 support, you should consider upgrading where possible.

Are SSH keys insecure? ›

SSH private keys are the crown jewels of remote access and a stolen key is a severe risk. Intruders can use stolen keys to impersonate users, access sensitive data, and take total control of a system.

How to encrypt a SSH key? ›

How Do I Encrypt an Unencrypted SSH Key?
  1. Make note of the private SSH key you wish to encrypt. For this example, let's assume it's in /Users/user/. ssh/id_rsa.
  2. Open the terminal.
  3. Type ssh-keygen -p -f /Users/user/. ssh/id_rsa and press enter.
Jul 17, 2024

How do I add a trusted SSH key? ›

The steps below will walk you through generating an SSH key and adding the public key to the server.
  1. Step 1: Check for SSH Keys. First, check for existing SSH keys on your computer. ...
  2. Step 2: Generate a new SSH key. ...
  3. Step 3: Add your key to the ssh-agent. ...
  4. Step 4: Add your SSH key to the server.
Apr 14, 2019

Top Articles
22 Foods and Drinks to Help Repair Your Lungs and Make Them Stronger
How can I highlight my ability to work under pressure on my resume?
Poe T4 Aisling
Somboun Asian Market
Rek Funerals
Bucks County Job Requisitions
Free VIN Decoder Online | Decode any VIN
The Idol - watch tv show streaming online
Fototour verlassener Fliegerhorst Schönwald [Lost Place Brandenburg]
Kent And Pelczar Obituaries
Campaign Homecoming Queen Posters
Local Collector Buying Old Motorcycles Z1 KZ900 KZ 900 KZ1000 Kawasaki - wanted - by dealer - sale - craigslist
Lake Nockamixon Fishing Report
Dignity Nfuse
Cyndaquil Gen 4 Learnset
Soccer Zone Discount Code
Spergo Net Worth 2022
Swgoh Turn Meter Reduction Teams
Saatva Memory Foam Hybrid mattress review 2024
Nordstrom Rack Glendale Photos
Halo Worth Animal Jam
Breckie Hill Mega Link
Marion City Wide Garage Sale 2023
Lost Pizza Nutrition
Lexus Credit Card Login
Craig Woolard Net Worth
Is Light Raid Hard
Cowboy Pozisyon
Sensual Massage Grand Rapids
Delta Math Login With Google
Wells Fargo Bank Florida Locations
Pixel Combat Unblocked
Warren County Skyward
Solarmovie Ma
Gideon Nicole Riddley Read Online Free
Craigslist Neworleans
Colorado Parks And Wildlife Reissue List
Pillowtalk Podcast Interview Turns Into 3Some
The Vélodrome d'Hiver (Vél d'Hiv) Roundup
Emerge Ortho Kronos
Body Surface Area (BSA) Calculator
Craigslist Freeport Illinois
Lake Andes Buy Sell Trade
Lyndie Irons And Pat Tenore
13 Fun & Best Things to Do in Hurricane, Utah
Kenner And Stevens Funeral Home
How to Connect Jabra Earbuds to an iPhone | Decortweaks
Dicks Mear Me
Theater X Orange Heights Florida
Naughty Natt Farting
Ff14 Palebloom Kudzu Cloth
Famous Dave's BBQ Catering, BBQ Catering Packages, Handcrafted Catering, Famous Dave's | Famous Dave's BBQ Restaurant
Latest Posts
Article information

Author: Delena Feil

Last Updated:

Views: 6490

Rating: 4.4 / 5 (45 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Delena Feil

Birthday: 1998-08-29

Address: 747 Lubowitz Run, Sidmouth, HI 90646-5543

Phone: +99513241752844

Job: Design Supervisor

Hobby: Digital arts, Lacemaking, Air sports, Running, Scouting, Shooting, Puzzles

Introduction: My name is Delena Feil, I am a clean, splendid, calm, fancy, jolly, bright, faithful person who loves writing and wants to share my knowledge and understanding with you.