A password in six places
Workload identity means a running program proves what it is with an identity it is given, not a secret somebody typed. Most services still call each other with a shared secret: a password or an API key in a file.
One database password copied to six servers must be changed in six places. So it is changed rarely, and anybody who copies it once can use it for years.
By the end of this lesson
Note
I can explain why an attested, short-lived identity is safer than a shared secret.
Key words
| Word | What it means | Example |
|---|---|---|
| Workload | a running program, such as a service or a pod | |
| Shared secret | a password or key that both sides keep | |
| Attestation | checking what a workload really is | |
| SPIFFE | a standard for naming and proving workloads | |
| SPIRE | software that hands out SPIFFE identities | |
| SVID | the document that carries an identity | an X.509 certificate |
The cells students fill in are left blank in this preview.
What goes wrong with shared secrets
A shared secret proves only that the caller knows the secret. It says nothing about which program is calling.
Secrets leak through logs, backups, images and old laptops. They live a long time, because rotating one means changing every copy at once. And when one leaks, you rarely know who used it.
Worked example: a secret against an identity
| Question | Shared secret | SPIFFE identity |
|---|---|---|
| Who makes it? | A person, once | SPIRE, for each running workload |
| How long does it last? | Months or years | An hour in this lab |
| How many copies? | One per server that uses it | None: each workload gets its own |
| What does it prove? | The caller knows the secret | What the caller is, checked by an agent |
| A stolen one is useful for | Until somebody notices | Until it expires |
The cells students fill in are left blank in this preview.
An identity is earned by attestation
SPIRE has two parts. The server signs identities. An agent runs on every machine and talks to the workloads there.
When a program asks the agent for an identity, the agent checks it first: which Unix user runs it, which Kubernetes pod it is in. This check is attestation. Only a workload that matches a registration gets anything.
Ask how SPIRE stands
spirelab statusShown here, not run. Press Start lab to type it into your own lab’s terminal.
List the agents the server trusts
sudo spire-server agent listShown here, not run. Press Start lab to type it into your own lab’s terminal.
What the two Runs printed
The status says the server and the agent are healthy, and names the trust domain lab.test. The agent list shows one agent, spiffe://lab.test/spire/agent/x509pop/spire-lab, with Can re-attest : true.
Its expiry time and serial number differ in every copy of the lab, because the agent's own identity is made when it starts.
No registration, no identity
The user basket stands for a workload on this machine. Nobody has registered it yet. The next Run asks the agent for its identity as that user.
It prints rpc error: code = PermissionDenied desc = no identity issued. The agent attested the process, found no entry for it, and gave it nothing.
Ask for an identity as basket
sudo -u basket spire-agent api fetch x509Shown here, not run. Press Start lab to type it into your own lab’s terminal.
A common mistake
Warning
Many people think workload identity just stores the secret somewhere safer. It does not store a secret at all. Each workload proves what it is when it asks, and receives a credential that expires within the hour.