Skip to content
Nokku LogoNokku
GuidesLearn the concepts

Certificates in plain words

What an SSH certificate is, why it beats copying keys, and how Nokku issues and renews them.

Last updated on

This page explains SSH certificates and how Nokku uses them. It builds on How SSH logins work.

A certificate is a signed public key

Remember the problem: every server needs a list of every public key it should accept. Certificates flip that around.

A certificate authority (CA) is one special key pair that everyone agrees to trust. Instead of copying your public key to every server, the CA signs it. The result is a certificate: your public key plus a few facts, sealed with the CA’s signature.

Servers then only need to trust one thing, the CA’s public key. Any certificate signed by that CA is recognized, no matter who it belongs to.

flowchart LR
  key["Your public key"] --> ca{{"CA signs it"}}
  ca --> cert["Your certificate"]
  cert -- "shown at login" --> server["Server"]
  trust["The CA's public key"] -. "trusted once" .-> server

It works like an ID card. The border officer has never seen you before, but they know what a real passport looks like and trust whoever issued it.

What’s written on a certificate

A bare public key says nothing about itself. A certificate carries facts, and the server checks every one:

  • Who signed it. Only certificates from a CA the server trusts are accepted.
  • When it is valid. Every certificate has an expiry date. After that it is useless.
  • Who it is for. These entries are called principals. Nokku writes down who you are, which server the certificate is for, and which Linux accounts you may use there. The next page explains why that’s clever.
  • What it allows. A terminal, port forwarding and the like. A certificate can also carry limits, like the addresses it may be used from. Each server still decides what a session may really do.

Your private key still never leaves your laptop. Only the public key gets signed.

Why this is better

  • Nothing to copy. A new colleague needs a certificate, not an edit on every server.
  • Access ends by itself. Certificates expire, so a forgotten one stops working on its own.
  • Every login has a name. The certificate says exactly who it belongs to, so logs and audits make sense.

Certificates for servers: no more “are you sure?”

The same trick works in the other direction. The CA also signs each server’s key, which gives the server a host certificate. Your client trusts the CA, so it can check the server’s certificate right away. The “Are you sure you want to continue connecting?” prompt from the last page never shows up.

Servers running nokkud get host certificates automatically and renew them before they expire.

How Nokku handles certificates for you

OpenSSH has supported certificates for years, and most teams still copy keys. By hand, someone has to guard the CA, sign every certificate again each time it expires, and keep every server’s lists current. Certificates only pay off when all of that is automated.

That automation is Nokku’s job. You never request, copy or renew a certificate by hand:

  • Every workspace gets its own CA when it is created. Its private keys stay inside the core, encrypted.
  • nk asks the core for a certificate the first time you connect to a server, and renews it before it runs out. Each server gets its own. That happens right before ssh needs it, so you don’t notice.
  • User certificates are short-lived. The workspace’s CA sets how long, see Certificate authority.
Under the hood
  • The CA has two Ed25519 keys. One signs user certificates, the other signs host certificates, so neither can stand in for the other.
  • A host certificate names the server’s target ID. nk writes a @cert-authority line per server into its own known_hosts file, so OpenSSH trusts the CA for exactly those servers.
  • A client may ask for a shorter lifetime. A request above the CA’s maximum gets the default lifetime instead.
  • A certificate never outlives the grant it was signed for, and a service account’s never outlives its token.
  • Rolling the CA over replaces both keys at once. Nothing trusts the old keys after that. See Roll over the CA.

Revoking access

Certificates expire, but you don’t want to wait for that to remove someone. Nokku doesn’t need to. Every server running nokkud also checks whether the certificate’s owner is still allowed on the requested account, using a list the core keeps up to date. Remove someone’s access and those servers get the new list right away. Their certificate is still valid, but it no longer opens anything, and sessions they still had open there are closed.

The core also signs nothing without a grant, so no new certificate is issued after a removal. That covers the servers that never get the new list:

  • Servers without the daemon have no list. They accept any certificate Nokku signed for them and the account. That is why their certificates are kept short. A removal stops new logins there once the person’s last certificate runs out. See Servers without the daemon.
  • A daemon server that was offline catches up at its next sync, or when the certificate runs out, whichever comes first.