0

Most place I have read that should be able to login just with only the user certificate. Testing a loopback login I have followed the following tutorial: https://goteleport.com/blog/how-to-configure-ssh-certificate-based-authentication/ and discovered I am misunderstanding a key concept:

You'll need both [the signed user certificate] and the private key for logging in.

I can't successfully ssh without the id_rsa key present alongside the id_rsa-cert.pub file. Within the certificate I've included root and personal user hence I can ssh root@host with no password which clearly uses the certificate as I have no key registration for root setup. It's using certificates registered in /etc/. Futhermore ssh user@host is successful without known_hosts or authorized_keys as I have in /etc/ssh/sshd_config

TrustedUserCAKeys /etc/ssh/user-ca.pub
HostCertificate /etc/ssh/ssh_host_rsa_key-cert.pub

and in Everywhere I have read that should be able to login just with the user certificate the public key of the certificate authority in /etc/ssh/ssh_known_hosts`:

@cert-authority * $(</etc/ssh/host-ca.pub)

I was sure I've logged in without id_rsa present in the past. Can authentication be successful with only the ~/.ssh/id_rsa-cert.pub file? If so what is this tutorial missing?

1

2 Answers 2

1

Answer: you require both key id_rsa and certificate id_rsa-cert.pub for a certificate based authentication. The key is always required to encrypt the packets, certificate provides a 3rd party trusted identifier to the server.

Both the user certificate and the private key it corresponds to are needed to log in. OpenSSH Cookbook

In this case the certificate permits you to login to a server you've never had prior knowledge of (you don't need your public key registered on the remote host's home directory's authorized_keys file) and the signing authority can provide time limits on the access or who you can masquerade as (Principal directive).

0

With OpenSSH clients on Unix/Linux and MacOS you can remove the private key file after loading it into ssh-agent. If you're not using ssh-agent you have to keep the private key file because the cert file only contains the signed public key.

The OpenSSH client on Windows behaves differently because the ssh-agent is a specific reimplementation based on Windows` LSASS cache.

That's the reason why my EKCA client does not remove the private key file after loading it into ssh-agent if running on Windows. (EKCA is my own minimal solution for issuing short-term OpenSSH user certs.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .